<template>
  <div class="layer">
    <div class="box flex column">
      <div class="title">{{title}}</div>
      <div class="buttons flex">
        <button @click="$emit('close')">关闭</button>
        <button @click="update">{{button}}</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: String,
    button: {
      default: "刷新",
      type: String
    }
  },
  methods: {
    update() {
      window.location.reload();
    }
  }
};
</script>

<style scoped lang="scss">
.layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 30000;
  .box {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    width: 300px;
    height: 150px;
    justify-content: center;
    align-items: center;
    background: black;
    border-radius: 4px;
    button {
      padding: 10px 30px;
      background: rgb(77, 77, 77);
      color: white;
      border: none;
      cursor: pointer;
      border-radius: 4px;
      letter-spacing: 1px;
      font-size: 13px;
      border: 1px solid rgb(68, 68, 68);
      margin: 0 10px;
    }
    .title {
      font-size: 18px;
      margin-bottom: 20px;
      color: white;
      letter-spacing: 1px;
    }
  }
}
</style>